@import "../../themes/ionic.globals.wp";

// Windows Segment
// --------------------------------------------------

/// @prop - Background of the segment button
$segment-button-wp-background-color:           transparent !default;

/// @prop - Text color of the activated segment button
$segment-button-wp-text-color-activated:       $toolbar-wp-text-color !default;

/// @prop - Padding of the segment button
$segment-button-wp-padding:                    0 6px !default;

/// @prop - Height of the segment button
$segment-button-wp-height:                     4rem !default;

/// @prop - Line height of the segment button
$segment-button-wp-line-height:                4rem !default;

/// @prop - Font size of the segment button
$segment-button-wp-font-size:                  1.3rem !default;

/// @prop - Text transform of the segment button
$segment-button-wp-text-transform:             uppercase !default;

/// @prop - Font weight of the segment button
$segment-button-wp-font-weight:                bold !default;

/// @prop - Opacity of the segment button
$segment-button-wp-opacity:                    .5 !default;

/// @prop - Opacity of the activated segment button
$segment-button-wp-opacity-activated:          1 !default;

/// @prop - Opacity of the disabled segment button
$segment-button-wp-opacity-disabled:           .3 !default;

/// @prop - Size of an icon in the segment button
$segment-button-wp-icon-size:                  2.6rem !default;

/// @prop - Line height of an icon in the segment button
$segment-button-wp-icon-line-height:           $segment-button-wp-line-height !default;

/// @prop - Position of the buttons in the segment
$segment-button-wp-buttons-justify-content:    flex-start !default;


.segment-wp {
  justify-content: $segment-button-wp-buttons-justify-content;
}

.segment-wp .segment-button {
  padding: $segment-button-wp-padding;

  height: $segment-button-wp-height;

  font-size: $segment-button-wp-font-size;
  font-weight: $segment-button-wp-font-weight;
  line-height: $segment-button-wp-line-height;

  text-transform: $segment-button-wp-text-transform;

  color: $segment-button-wp-text-color-activated;
  background-color: $segment-button-wp-background-color;
  opacity: $segment-button-wp-opacity;

  &.segment-activated {
    opacity: $segment-button-wp-opacity-activated;
  }

  ion-icon {
    font-size: $segment-button-wp-icon-size;
    line-height: $segment-button-wp-icon-line-height;
  }
}

.segment-wp .segment-button-disabled {
  opacity: $segment-button-wp-opacity-disabled;

  pointer-events: none;
}

.toolbar {

  .segment-wp {
    margin: 0 auto;
  }
}


// Windows Segment Button Mixin
// --------------------------------------------------

@mixin wp-segment-button($color-name, $color-base) {

  .segment-wp-#{$color-name} .segment-button {
    color: $color-base;

    &.activated,
    &.segment-activated {
      border-color: $color-base;
      color: $color-base;
      opacity: $segment-button-wp-opacity-activated;
    }
  }

}


// Windows Segment Color Generation
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) {
  @include wp-segment-button($color-name, $color-base);
}
